/*
 * @Description: 话术库接口api
 * @Author: lixianggang
 * @Date: 2022-10-20 11:13:17
 * @LastEditors: lixianggang
 * @LastEditTime: 2022-12-28 16:33:06
 */
import request from '@/utils/request'

// 更新人数上限 /admin/wecom/group/chat/updateMemberLimit
export function updateMemberLimit(data) {
  return request({
    url: '/admin/wecom/group/chat/updateMemberLimit',
    method: 'POST',
    data
  })
}

// 查询分组列表
export function getGroupList(params) {
  return request({
    url: '/admin/wecom/category/list',
    method: 'get',
    params
  })
}

export const categoryDel = (params) => {
  return request({
    url: '/admin/wecom/groupCode/' + params,
    method: 'delete'
  })
}

export function uploadInterface(data) {
  return request({
    url: '/admin/common/uploadFile',
    method: 'POST',
    data
  })
}

export function uploadFile(data) {
  return request({
    url: '/admin/common/upload',
    method: 'POST',
    data
  })
}

// 添加个人分组
export function addPersonGroup(data) {
  return request({
    url: '/admin/wecom/category/personal/add',
    method: 'post',
    data
  })
}

// 添加企业分组
export function addCompanyGroup(data) {
  return request({
    url: '/admin/wecom/category/corp/add',
    method: 'post',
    data
  })
}

// 编辑个人分组
export function updatePersonGroup(data) {
  return request({
    url: '/admin/wecom/category/personal/edit',
    method: 'put',
    data
  })
}

// 编辑企业分组
export function updateCompanyGroup(data) {
  return request({
    url: '/admin/wecom/category/corp/edit',
    method: 'put',
    data
  })
}

// 删除个人分组
export function deleteGroup(id) {
  return request({
    url: '/admin/operate/material/deleteGroup' + '/' + id,
    method: 'delete'
  })
}

// 删除企业分组
export function deleteGroupCorp(id) {
  return request({
    url: '/admin/operate/material/deleteGroupCorp' + '/' + id,
    method: 'delete'
  })
}

// 查询话术列表
export function getVerbalList(params) {
  return request({
    url: '/admin/operate/material/list',
    method: 'get',
    params
  })
}

// 导入话术接口
export function importVerbal(data) {
  return request({
    url: '/admin/operate/material/importMaterial',
    method: 'post',
    data
  })
}

// 导出话术接口
export function exportVervalExcel(data) {
  return request({
    url: '/admin/operate/material/exportPartExcel',
    method: 'post',
    data,
    responseType: 'blob'
  })
}

// 新增话术接口
export function addVerbal(data) {
  return request({
    url: '/admin/operate/material/add',
    method: 'post',
    data
  })
}

//查询文件详情接口
export function getFileVerbal(id) {
  return request({
    url: '/admin/admin/detail/info' + '/' + id,
    method: 'get'
  })
}

// 查询话术接口
export function getVerbal(id) {
  return request({
    url: '/admin/wecom/material' + '/' + id,
    method: 'get'
  })
}

// 编辑个人话术接口
export function updateVerbal(data) {
  return request({
    url: '/admin/wecom/material/media',
    method: 'put',
    data
  })
}

// 编辑企业话术接口
export function updateCompanyVerbal(data) {
  return request({
    url: '/admin/wecom/material/media/corp',
    method: 'put',
    data
  })
}

// 删除个人话术接口
export function deleteVerbal(id) {
  return request({
    url: '/admin/wecom/material' + '/' + id,
    method: 'delete'
  })
}

// 删除企业话术接口
export function deleteCompanyVerbal(id) {
  return request({
    url: '/admin/wecom/material/corp' + '/' + id,
    method: 'delete'
  })
}

export const groupCode = (params) => {
  return request({
    url: '/admin/wecom/groupCode/list',
    method: 'get',
    params
  })
}

// 查询渠道活码列表
export const verbalList = (params) => {
  return request({
    url: '/admin/admin/code/list',
    method: 'get',
    params
  })
}

// 新增渠道活码
export const verbalAdd = (data) => {
  return request({
    url: '/admin/admin/code',
    method: 'post',
    data
  })
}
// 编辑渠道活码
export const verbalEdit = (data) => {
  return request({
    url: '/admin/admin/code',
    method: 'put',
    data
  })
}
// 查看渠道活码
export const verbalDetail = (params) => {
  return request({
    url: `/admin/admin/code/${params.id}`,
    method: 'get'
  })
}

// 删除渠道活码
export const verbalDelete = (params) => {
  return request({
    url: `/admin/admin/code/${params.id}`,
    method: 'delete'
  })
}

export const getUser = (data) => {
  return request({
    url: '/admin/permission',
    method: 'post',
    data
  })
}

export const addGroupCode = (data) => {
  return request({
    url: '/admin/wecom/groupCode',
    method: 'post',
    data
  })
}
export const editCreate = (data) => {
  return request({
    url: '/admin/wecom/groupCode',
    method: 'put',
    data
  })
}
export const removInginterface = (data) => {
  return request({
    url: '/admin/wecom/groupCode/deleteGroupById',
    method: 'post',
    data
  })
}
// export const removInginterface = params => {
//   return request({
//     url:"/admin/wecom/groupCode" + "/" +  params,
//     method: 'delete'
//   })
// }
export const establish = (params) => {
  return request({
    url: `/admin/wecom/groupCode/${params.id}`,
    method: 'get'
  })
}

export const welcomList = () => {
  return request({
    url: '/admin/wecom/tlp/list',
    method: 'get'
  })
}

export const groupList = (params) => {
  return request({
    url: '/admin/wecom/group/chat/findGroupList',
    method: 'get',
    params
  })
}

export const liveCodeGroupList = (params) => {
  return request({
    url: '/admin/wecom/group/chat/list',
    method: 'get',
    params
  })
}

export const groupConfig = (data) => {
  return request({
    url: '/admin/wecom/groupCode/getGroupConfig',
    method: 'post',
    data
  })
}

// 删除渠道活码分组
export function deleteGroupTool(data) {
  return request({
    url: `/admin/admin/code/deleteGroupById/${data}`,
    method: 'delete'
  })
}

//查询员工活码
export const getCustConfig = (data) => {
  return request({
    url: '/admin/wecom/groupCode',
    method: 'post',
    data
  })
}

export const getCustCode = (params) => {
  return request({
    url: '/admin/wecom/user/getQrCode',
    method: 'get',
    params
  })
}

// 渠道活码分析查询
export const getActiveAnalysisList = (params) => {
  return request({
    url: '/admin/weGroupCodeRecord/list',
    method: 'get',
    params
  })
}

// 渠道活码分析图表查询
export const getActiveAnalysisEchartData = (data) => {
  return request({
    url: '/admin/weGroupCodeRecord/querygraph',
    method: 'post',
    data
  })
}

// 渠道活码分析图表查询员工列表
export const getEchartUserList = (data) => {
  return request({
    url: '/admin/weGroupCodeRecord/queryuser',
    method: 'post',
    data
  })
}
// 导出定时任务调度
export function exportActiveAnalysis(params) {
  return request({
    url: '/admin/weGroupCodeRecord/export',
    method: 'get',
    params
  })
}
